package com.xpffly.design.decorator.common.service.impl;

import com.xpffly.design.decorator.common.service.Component;

/**
 * @Author: xpengfei
 * @Date: 2021/4/8 23:45
 * @Description：抽象装饰者
 */
public class Decorator extends Component {

    private Component component = null;

    /**
     * 通过构造函数传递被装饰者
     *
     * @param component 被装饰者
     */
    public Decorator(Component component) {
        this.component = component;
    }

    /**
     * 抽象方法，委托给被装饰者执行
     */
    @Override
    public void operate() {
        this.component.operate();
    }
}
